<?php
class acc_mgt_mod extends CI_Model 
{
	function validate($email,$password)
	{
		$this->db->where('u_email', $email);
		$this->db->where('u_password', md5($password));
		$query = $this->db->get('users');
		
		if($query->num_rows() == 1)
		{
			return true;
		}
		else
			return false;
	}
	function is_email_exist($email)
	{
		$this->db->where('u_email', $email);
		$query = $this->db->get('users');
		if($query->num_rows() == 1)
		{
			return true;
		}
		else
			return false;
	}
	function create_user($data)
	{
		$insert = $this->db->insert('users', $data);
		return $insert;
	}
	function getId($email)
	{
		$this->db->where('u_email', $email);
		$query = $this->db->get('users');
		return $query;
	}
	function add_tags($data)
	{
		$insert = $this->db->insert('tags', $data);
		return $insert;
	}
	function get_tags($id)
	{
		$this->db->where('u_id', $id);
		$query = $this->db->get('tags');
		return $query;
	}
	function change_pass($email,$password)
	{
		$data=array('u_password'=>md5($password));
		$this->db->where('u_email', $email);
		$this->db->update('users', $data);
	}
	
}